package com.smallerp.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

@Entity
public class Employee {
	private int employeeId;
	private String employeeName;
	private char sex;
	private String employeePhone;
	private EmployeeCard employeeCard;
	private Department department;
	private Set<MyGroup> groups=new HashSet<MyGroup>();
	@ManyToOne
	@JoinColumn(name="departmentid")
	public Department getDepartment() {
		return department;
	}
	@OneToOne
	@JoinColumn(name="employeecardid")
	public EmployeeCard getEmployeeCard() {
		return employeeCard;
	}
	@Id
	@GeneratedValue
	public int getEmployeeId() {
		return employeeId;
	}
	@Column(length=20)
	public String getEmployeeName() {
		return employeeName;
	}
	public String getEmployeePhone() {
		return employeePhone;
	}
	@ManyToMany
	@JoinTable(name="emp_group",
			joinColumns={@JoinColumn(name="emp_id")},
			inverseJoinColumns={@JoinColumn(name="group_id")}
			)
	public Set<MyGroup> getGroups() {
		return groups;
	}
	public char getSex() {
		return sex;
	}
	public void setDepartment(Department department) {
		this.department = department;
	}
	public void setEmployeeCard(EmployeeCard employeeCard) {
		this.employeeCard = employeeCard;
	}
	public void setEmployeeId(int employeeId) {
		this.employeeId = employeeId;
	}
	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}
	public void setEmployeePhone(String employeePhone) {
		this.employeePhone = employeePhone;
	}
	public void setGroups(Set<MyGroup> groups) {
		this.groups = groups;
	}
	public void setSex(char sex) {
		this.sex = sex;
	} 
}
